<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"  href="/styles/general.css"/>
<link rel="stylesheet" type="text/css" href="/styles/main.css"/>
<link rel="stylesheet" type="text/css" href="/styles/validator.css"/>
<script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/js/formValidator.js" type="text/javascript"></script>
<script src="/js/formValidatorRegex.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({formid:"myform",onerror:function(msg){alert(msg)}});
	$("#compoundno").formValidator({onshow:"请输入内部编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#compoundid").formValidator({onshow:"请输入化合物编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#v1").formValidator({onshow:"请输入给药剂量",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#v2").formValidator({onshow:"请输入LD50",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#v3").formValidator({onshow:"请输入给药天数",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#v4").formValidator({onshow:"请输入MTD",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#v5").formValidator({onshow:"请输入试验名称",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#v5result").formValidator({onshow:"请输入结果",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#notebookid").formValidator({onshow:"请输入实验记录本编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#page").formValidator({onshow:"请输入页码",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#expdate").formValidator({onshow:"请输入实验日期",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#compoundno").bind('change', function(event) {
		$.ajax({			
	        url: "/bioduxing/getidbyno/no/"+$("#compoundno").val(),
	        cache: false,
	        success: function(html){
	        	arr = html.split(",");	        	
	        	if(arr[0]==""){
	        		alert("您输入的编号不存在，请重新输入");
	        		return false;
	        	}	        		
	        	if(arr[2]>"0"){
	        		alert("该编号的信息已经存在，请不要重复添加");
	        		return false;
	        	}
	        	$("#img").attr("src","/svg/big/"+arr[0]+".gif");
	        	$("#projectid").val(arr[1]);
	        	$("#compoundid").val(arr[0]);
	        	//alert(arr[1]);
	        }
	    });
	});
	$("#extype").bind('change', function(event) {
		$.ajax({			
	        url:"/bioduxing/extypeajax/id/$id/v/"+$(this).attr("value"),
	        cache: false,
	        success: function(html){
        		$("#extypespan").html(html);
        	}
      });  
	});
	$("#extype").trigger('change');
});
</script>
<title></title>
</head>
<body>
<h1>
<span class="action-span"><a href="/bioduxing">管理毒性信息</a></span>
<span class="action-span1"> 添加毒性信息</span>
<div style="clear:both"></div>
</h1>
<div class="main-div">
  <form action="/bioduxing/add/" method="post" name="myform" id="myform" enctype="multipart/form-data">
  <table width="100%" id="table_form">
  	 <tr>
      	<td rowspan="19" style="width:350px"><img id="img" src="" /></td>
        <td class="label">化合物编号：</td>
        <td>
        	{form text * compoundno compoundno}
			{form hidden * compoundid compoundid}
        </td>
        <td><div id='compoundidTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">试验类型：</td>
        <td>
			{form select * extype extype * * * $extype}
        </td>
        <td><div id='extypeTip' style="width:250px"></div></td>
      </tr>
      <tr>
		<td cplspan="3">
			<table  id="extypespan" width="100%"></table>
		</td>
	 </tr>
        <td class="label">实验记录本编号：</td>
        <td>
			{form text * notebookid notebookid}
        </td>
        <td><div id='notebookidTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">页码：</td>
        <td>
			{form text * page page}
        </td>
        <td><div id='pageTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">实验日期：</td>
        <td>
			{form datetime * expdate expdate}
        </td>
        <td><div id='expdateTip' style="width:250px"></div></td>
      </tr>
  </table>  
   <div class="button-div">
        <input type="submit" value="&nbsp;确&nbsp;定&nbsp;" />
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" value="&nbsp;重&nbsp;置&nbsp;" />
   </div>
  </form>
</div>
{template 'footer.html'}
</body>
</html>